package com.yelobblog.yelobblog.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yelobblog.yelobblog.common.untils.Response;
import com.yelobblog.yelobblog.domain.entity.logs;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import com.yelobblog.yelobblog.service.logsService;
@RestController
@RequestMapping("/logs")
public class logsController {
    @Resource
    private logsService logsService;
    @GetMapping("/getLogs")
    public Response<Page<logs>> getLogs(@RequestParam Integer pageNum,@RequestParam Integer pageSize) {
        return Response.success(logsService.getLogs(pageNum,pageSize));
    }
    @PostMapping("/addLogs")
    public Response<String> addLogs(@RequestBody logs logs) {

        logsService.save(logs);
        return Response.success();
    }
    @DeleteMapping("/deleteLogs")
    public Response<String> deleteLogs(@RequestBody logs logs) {
        logsService.removeById(logs);
        return Response.success();
    }
    @PutMapping("/updateLogs")
    public Response<String> updateLogs(@RequestBody logs logs) {
        logsService.updateById(logs);
        return Response.success();
    }
}
